# Importing Data
CAMBODIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Rubber/Rubber.xlsx",sheet = "Sheet1", range = "k1:k325")

# Checking the Imported Data
View(CAMBODIA)
# Creating Time Series Data
CAMBODIA_ts <- ts(CAMBODIA, start=c(2005,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
CAMBODIA_ts
sum(is.na(CAMBODIA_ts))
library(forecast)
CAMBODIA_ts <- tsclean(CAMBODIA_ts)
CAMBODIA_ts

# Identification: Plotting the Time Series Data
plot(CAMBODIA_ts)

# Estimating the appropriate model
CAMBODIA_ts_model <- auto.arima(CAMBODIA_ts)
CAMBODIA_ts_model

# Forecasting
options(max.print=1000000)
CAMBODIA_ts_forecast <- forecast (CAMBODIA_ts_model, level=c(95), h=288)
plot(CAMBODIA_ts_forecast)
CAMBODIA_ts_forecast             

# Exporting
write.table(CAMBODIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Rubber/CAMBODIA_TSA.csv", sep=",")


